<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>健康档案</title>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css') }}">
    <style>
        .search-bar input {
            padding: 5px;
            margin-right: 5px;
        }

        .section {
            padding: 20px;
            background: #fff;
            margin: 20px auto;
            max-width: 800px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 20px;
        }

        table th, table td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        table th {
            background-color: #f4f4f9;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            font-weight: bold;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            margin-top: 5px;
            border: 1px solid #ddd;
            border-radius: 5px;
        }

        .form-group button {
            background-color: #0066cc;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .form-group button:hover {
            background-color: #004080;
        }

    </style>
</head>
<body>

<header>
    <h1>老年人健康档案服务平台</h1>
</header>

<!-- 导航栏 -->
<nav>
    <div>
        <a href="{{ url_for('index') }}">首页</a>
        <a href="{{ url_for('health_data') }}">健康档案</a>
        <a href="{{ url_for('health_analysis') }}">健康分析</a>
        <a href="{{ url_for('personal_advice') }}">个性化建议</a>
        <a href="{{ url_for('community') }}">健康社区</a>
        <a href="{{ url_for('contact') }}">联系我们</a>
    </div>
</nav>

<!-- 健康档案 -->
<div class="section" id="health-data">
    <h2>健康档案</h2>
    
    <!-- 添加新记录的表单 -->
    <form action="/health-data" method="POST">
        <h3>添加新记录</h3>
        <div class="form-group">
            <label for="item">项目</label>
            <input type="text" id="item" name="item" placeholder="如：体重" required>
        </div>
        <div class="form-group">
            <label for="value">记录值</label>
            <input type="text" id="value" name="value" placeholder="如：70 kg" required>
        </div>
        <div class="form-group">
            <label for="date">测量时间</label>
            <input type="date" id="date" name="date" required>
        </div>
        <button type="submit">添加记录</button>
    </form>

    <!-- 健康档案记录的表格 -->
    <h3>健康档案记录</h3>
    <table id="health-table">
        <thead>
            <tr>
                <th>项目</th>
                <th>记录值</th>
                <th>测量时间</th>
            </tr>
        </thead>
        <tbody>
            {% for record in records %}
            <tr>
                <td>{{ record[1] }}</td>  <!-- record[1] 对应 item -->
                <td>{{ record[2] }}</td>  <!-- record[2] 对应 value -->
                <td>{{ record[3] }}</td>  <!-- record[3] 对应 date -->
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>

<footer>
    <p>© 2024 老年人健康档案服务平台 | 地址: 北京市某区某街道100号</p>
</footer>

</body>
</html>
